class Car(val license: String, val brand: String, var color: String, var price: Double) {
  def drive(): Unit = {
    println(s"Driving $license $brand car.")
  }
  def park(): Unit = {
    println(s"Parking $license $brand car.")
  }
  def refuel(): Unit = {
    println(s"Refueling $license $brand car.")
  }
}

class ElectricCar(license: String, brand: String, color: String, price: Double,val batteryCapacity: Double, var range: Double) extends Car(license, brand, color, price) {
  def charge(): Unit = {
    println(s"Charging $license $brand electric car.")
    range = batteryCapacity * 100
  }
  override def drive(): Unit = {
    if (range > 0) { 
      super.drive() 
      range -= 10 
    } else { 
      println(s"Cannot drive $license $brand electric car. Please charge it first.")
    }
    
  }
}
